struct Point {
    // 坐标结构体
    x: f64,
    y: f64,
}

impl Point {
    fn new(x: f64, y: f64) -> Point {
        Point { x, y }
    }

    // 实例方法，计算点到原点的距离
    fn distance_to_origin(&self) -> f64 {
        println!("self相当于this,x的距离是{},y的距离是{}", self.x, self.y);
        return (self.x.powi(2) + self.y.powi(2)).sqrt();
    }
}

pub fn get_point(x: f64, y: f64) -> f64 {
    let point = Point::new(x, y);
    let distance = point.distance_to_origin();
    return distance;
}
